import java.util.Arrays;

public class Solution1013 {
    public boolean canThreePartsEqualSum(int[] arr) {
        int sum= Arrays.stream(arr).sum();
        if (sum%3!=0){
            return false;
        }
        sum=sum/3;
        int t=1;
        int s=arr[0];
        while (s!=sum && t<arr.length){
            s+=arr[t];
            t++;
        }
        if (t==arr.length){
            return false;
        }
        s=arr[t];
        t++;
        while (s!=sum && t<arr.length){
            s+=arr[t];
            t++;
        }
        return t!=arr.length;
    }

    public static void main(String[] args) {
        System.out.println(new Solution1013().canThreePartsEqualSum(new int[]{0,2,1,-6,6,-7,9,1,2,0,1}));
    }
}
